//
//  BottomBar.m
//  costa-postcards
//
//  Created by 黄 鹏霄 on 12-12-14.
//  Copyright (c) 2012年 test. All rights reserved.
//

#import "BottomBar.h"

@implementation BottomBar
@synthesize delegate = _delegate;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        UIButton *addButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        addButton.frame = CGRectMake(5, 5, 44, 44);
        [addButton setTitle:@"new" forState:UIControlStateNormal];
        [addButton addTarget:self action:@selector(new:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:addButton];
        
        UIButton *colorButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        colorButton.frame = CGRectMake(200, 5, 44, 44);
        [colorButton setTitle:@"color" forState:UIControlStateNormal];
        [colorButton addTarget:self action:@selector(corlor:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:colorButton];
        
        UIButton *borderButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        borderButton.frame = CGRectMake(250, 5, 50, 44);
        [borderButton setTitle:@"border" forState:UIControlStateNormal];
        [borderButton addTarget:self  action:@selector(border:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:borderButton];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

#pragma mark - color selection
- (void)corlor:(UIButton *)sender
{
    [[self delegate] willColorSelectControllerDisplay:sender];
}

#pragma mark - new 
-(void)new:(UIButton *)sender
{
    [[self delegate]willSelectComponentDisplay:sender];
}

#pragma mark - border
-(void)border:(UIButton *)sender
{
    [[self delegate]willBorderSelectControllerDisplay:sender];
}

@end
